home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / TIPS / MINMAX.PAS < prev    next >
Pascal/Delphi Source File  |  1994-03-15  |  1KB  |  56 lines

  1. {************************************************}
  2. {                                                }
  3. {   Turbo Pascal for Windows                     }
  4. {   Tips & Techniques Demo Program               }
  5. {   Copyright (c) 1991 by Borland International  }
  6. {                                                }
  7. {************************************************}
  8.  
  9. program MinMaxRestriction;
  10.  
  11. uses
  12.   WinTypes, WinProcs, WObjects;
  13.  
  14. type
  15. TApp = object(TApplication)
  16.   procedure InitMainWindow; virtual;
  17. end;
  18.  
  19. PMyWindow = ^TMyWindow;
  20. TMyWindow = Object(TWindow)
  21.   procedure GetMinmaxinfo(var Msg: TMessage); virtual wm_GetMinMaxInfo;
  22. end;
  23.  
  24. procedure TApp.InitMainWindow;
  25. begin
  26.   MainWindow := New(PMyWindow, Init(nil, 'MinMaxRestriction'));
  27. end;
  28.  
  29. procedure TMyWindow.GetMinMaxInfo(var Msg:TMessage);
  30. type
  31.   TMyPoints = array[0..4] of TPoint;
  32. var
  33.   MyPoints: ^TMyPoints;
  34.  
  35. begin
  36.   MyPoints:= Pointer(Msg.lParam);
  37.  
  38.   MyPoints^[2].x:=100;     { window origin when maximized }
  39.   MyPoints^[2].Y:=100;
  40.  
  41.   MyPoints^[3].x:=100;     { minimum width and height }
  42.   MyPoints^[3].Y:=200;
  43.  
  44.   MyPoints^[4].x:=500;     { maximum width and height }
  45.   MyPoints^[4].Y:=400;
  46. end;
  47.  
  48. var
  49.   App:TApp;
  50.  
  51. begin
  52.   App.Init('MinMaxDemo');
  53.   App.Run;
  54.   App.Done;
  55. end.
  56.